//
//  SmartGroup.h
//  Groups
//
//  Created by Mathieu on 1/08/06.
//  Copyright 2006 __MyCompanyName__. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import "Group.h"

@interface SmartGroup : Group {
	
	@private;
	// cached fetch request and predicate
    NSFetchRequest      *fetchRequest;       
    NSPredicate         *predicate;          
	
    // cached words set
	int wordCount;
    NSSet               *words;
	NSString            *groupImageName;
	id cachedNameWithImage;
	int wordCountCache;


}

// Accessor for the array of words for the SmartGroup
- (NSSet *)words;
//for customising the smart group
-(void)setExtraPredicate:(NSString *)extraPredicate;


	// Accessor for the predicate used by the SmartGroup to return matching Words
//- (NSPredicate *)predicate;
//-(NSString *)predicateAsString;
- (void)setName:(NSString *)value;
- (int)wordCount;

-(NSPredicate *)smartGroupFilterPredicate;

	// Mutator for the predicate used by the SmartGroup to return matching Words
//- (void)setPredicate: (NSPredicate *)predicate;

	// Accessor for the fetch request for the SmartGroup
- (NSFetchRequest *)fetchRequest;

	// Triggers the smart group to refresh its words. 
- (void)refresh;

- (bool)isManualGroup;
- (bool)isThisGroupTheLibrary;


	// Overridden by subclasses to specify the icon to display in main outline view
- (NSString *)groupImageName;

	// Accesors that allow displaying the name of the group with the corresponsing 
	// icon;  this is used in the outline view of the main window
- (NSAttributedString *)nameWithImage;
- (void)setNameWithImage:(NSString *)nameWithImage;
@end
